home *** CD-ROM | disk | FTP | other *** search
/ Windows Expert / Windows Expert.iso / windownt / perlnt.zip / eg / grepsrc.cmd < prev    next >
OS/2 REXX Batch file  |  1993-07-25  |  520b  |  30 lines

  1. @rem = '-*- Perl -*-';
  2. @rem = '
  3. @echo off
  4. perl -S %0.cmd %1 %2 %3 %4 %5 %6 %7 %8 %9
  5. goto endofperl
  6. ';
  7.  
  8. require 'ntfind.pl';
  9.  
  10. $switches = substr($ARGV[0], 0) eq "-" ? $ARGV[0] : "";
  11. $pattern = substr($ARGV[0], 0) eq "-" ? $ARGV[1] : $ARGV[0];
  12.  
  13. &find('.');
  14.  
  15. exit;
  16.  
  17. sub wanted {
  18.     local($x);
  19.     local($line);
  20.     return if !/^.*[.][chy]$/;
  21.     $x = `grep $pattern $switches $_`;
  22.     return if $x eq "";
  23.     foreach $line (split(/\n/, $x)) {
  24.     print "$_: $line\n";
  25.     }
  26. }
  27. __END__
  28. :endofperl
  29.  
  30.